//
//  PlayVideoViewController.swift
//  约健
//
//  Created by tyh on 2017/10/13.
//  Copyright © 2017年 tyh. All rights reserved.
//

import UIKit
import AVKit
import  AVFoundation

class PlayVideoViewController: UIViewController {
    var str:String!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidLoad()
        
        let videoURL = URL(string: str)!
        let player = AVPlayer(url: videoURL)
        let palyerViewController = AVPlayerViewController()
        palyerViewController.player = player
        self.present(palyerViewController, animated: true) {
        palyerViewController.player?.play()
        }

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
